<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class UserCollecting extends Model
{
    use HasFactory;

//    use SoftDeletes;

    protected $table="user_collecting";

    protected $guarded = [];


    public static function collecting($uid,$fangId,$fangType)
    {
        $create = ['uid'=>$uid,'fang_id'=>$fangId,'fang_type'=>$fangType];
        return self::create($create);
    }

    public static function cancel($uid,$fangId)
    {
        return self::where(['uid'=>$uid,'fang_id'=>$fangId])->delete();
    }

    public static function show($uid,$fangId)
    {
        return self::where(['uid'=>$uid,'fang_id'=>$fangId])->first();
    }
}
